I have the following code that worked in version 2.0.1, now I get the error "PhalconException: The method 'findByEmail' doesn't exist on model 'User'":
public function emailExists($request) {
$email = $request->email;
$exists = count($this->findByEmail($email)) > 0;
$user = $this->getDi()->getShared('session')->get('auth');
if (!empty($user) && $user->email == $email) {
return true;
} else if (!$exists) {
return true;
}
return false;
}
I have since upgraded to 2.0.5. I changed to use the regular find method since I got the error, and it's returning values that it shouldn't. [email protected] is the only user I have right now in my DB. I pass in [email protected] as the $email and it returns the [email protected] record.
public function emailExists($request) {
$email = $request->email;
$exists = count($this->find(["email"=>$email])) > 0;
$user = $this->getDi()->getShared('session')->get('auth');
if (!empty($user) && $user->email == $email) {
return true;
} else if (!$exists) {
return true;
}
return false;
}